//#include "stdafx.h"
#include "DlgOffset.h"
#include "globals.h"

CGoToDlg::CGoToDlg(HWND hWnd)
	: CDialog(hWnd,IDD)
{
}

void CGoToDlg::OnInitDialog()
{
	if( iGotoDialogBufLength == 0 )
	{
		iGotoDialogBufLength = SendMessage( GetDlgItem( GetWnd(), IDC_EDIT1 ), EM_GETLIMITTEXT, 0, 0 );
		
		pcGotoDialogBuffer = new TCHAR[iGotoDialogBufLength];
		if( pcGotoDialogBuffer == NULL )
			MessageBox(_T("Could not allocate Goto buffer."), _T("Go to error:"), MB_OK | MB_ICONERROR );
		memset( pcGotoDialogBuffer, 0, iGotoDialogBufLength );
	}
	if( pcGotoDialogBuffer != NULL )
		::SetWindowText( GetDlgItem (GetWnd(), IDC_EDIT1), pcGotoDialogBuffer );
	//SetFocus(GetWnd());
}

UINT CGoToDlg::OnOK()
{
	GetDlgItemText( GetWnd(), IDC_EDIT1, pcGotoDialogBuffer, iGotoDialogBufLength );

	return DLGMESS_CLOSE;
}
